# 定义函数求平均值
# def get_avg(a, b, c):
#     return (a + b + c) / 3
#
#
# print(get_avg(1, 2, 3))

# 求两个班级学生的平均年龄
stu_list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
stu_list2 = [10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10, 20, 30, 40, 50, 10]


def get_age_sum(age_list: list):
    sum = 0
    for i in age_list:
        sum += i
    return sum


def get_cnt(age_list: list):
    return len(age_list)


def get_age_avg():
    class1_cnt = get_cnt(stu_list1)
    class1_age_sum = get_age_sum(stu_list1)

    class2_cnt = get_cnt(stu_list2)
    class2_age_sum = get_age_sum(stu_list2)

    age_avg = (class1_age_sum + class2_age_sum) / (class1_cnt + class2_cnt)
    return age_avg


print(get_age_avg())
